import sympy as sp
t = sp.Symbol('t')
s_x = 2*t # 水平位移函数
s_y = t**2 # 垂直位移函数
s_sum = s_x + s_y # 总位移函数

# 分别求导再相加
deriv_manual = sp.diff(s_x, t) + sp.diff(s_y, t)
# 直接对和函数求导
deriv_auto = sp.diff(s_sum, t)

print(f"手动计算 s_x' + s_y' = {deriv_manual}")
print(f"自动计算 (s_x + s_y)' = {deriv_auto}")
print(f"结果一致: {deriv_manual == deriv_auto}")